Briefly explain me about do-while loop with its example.
Describe about do-while loop.
502
21-Jan-2020
Nishi Tiwari
21-Jan-2020Do-While statement is used to execute the block of statement until the condition is true.
It is similar to while loop but the only difference is that, in while loop the block of statement will execute only when the condition is true, but in do-while statement will execute at least once, because the body of statement will execute first then the condition is checked.
We use keyword do and while to create the body for do-while loop.
Syntax
Example
Output:-